#include<iostream>
#include<fstream>
#include<boost/mpi.hpp>
#include <boost/mpi/environment.hpp>
#include <boost/mpi/communicator.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
using namespace boost::mpi;
#include"sm_system.h"
#include"sm_solver.h"

using std::cout;
using std::cin;
using std::endl;

using namespace SM;

int main()
{
  environment env;
  communicator world;
  System_Tz_HO effV;
  System_Tz_SM_M effVm;
  System_Tz_HF Vhf;
  //System_Tz_Gammow Vgam;

  int N=1;
  int Z=1;
  double Emax;
  if(world.rank()==0)
    {
      cin>>N>>Z;
      cin>>Emax;
      effV.setInputFiles("../sppn1.dat","../vpn1.dat");
      // effV.setInputFiles("../spox16.dat","../vint2.dat");
      // effV.setInputFiles("../sp.dat","../vint.dat");      
      effV.setup();

      Vhf.setup(&effV,N+Z,Z);
      effVm.setup(&Vhf,N+Z);

      // Vgam.setup(&effV,N+Z,Z);
      // effVm.setup(&Vgam,N+Z);

      // effVm.setup(&effV,N+Z);      
    }
  broadcast(world,N,0);
  broadcast(world,Z,0);
  broadcast(world,Emax,0);
  broadcast(world,effVm,0);  

    
  SMSolver smsolver(world,&effVm,N,Z);//,vN,vZ
  smsolver.diag_lanczos(5,0,0,Emax);//num,MM,Par,Emax,step=1
  //  smsolver.diag(0,0,350);  
  smsolver.printStates(5);
  //  smsolver.calOccuNums(0);
  //  smsolver.printOccuNums();
  return 0;
}
